Ext.onReady(function(){
	Ext.QuickTips.init();

	// turn on validation errors beside the field globally
	Ext.form.Field.prototype.msgTarget = 'side';

	// var bd = Ext.getBody();

	/*
	 * ================  Simple form  =======================
	 */
	// bd.createChild({tag: 'h2', html: 'Form 1 - Very Simple'});


	var simple = new Ext.FormPanel({
		labelWidth: 75, // label settings here cascade unless overridden
		//url:'save-form.php',
		frame:true,
		bodyStyle:'padding:5px 5px 0',
		width:400,
		height:300,
		buttonAlign:'center',
		//renderTo:Ext.getBody(),
		//render:Ext.getBody(),
		//defaultType: 'textfield',

		items: [{
			xtype:'textfield',
			fieldLabel: 'First Name',
			name: 'fname',
			value:'Samrat',
            "text-align":'center'


				//   readOnly:true

		},{
			xtype:'textfield',
			fieldLabel: 'Last Name',
			name: 'last',

			//readOnly:true,
			value:'PrabhuDessai'
		},{
			xtype:'textfield',
			fieldLabel: 'PhoneNo',
			name: 'phoneno',

			vtype:'num',
			//  readOnly:true,
			value:'2752485'
		}, {
			xtype:'textfield',
			fieldLabel: 'Email',
			name: 'email',

			vtype:'email',
			// readOnly:true,
			value:'samrat@gmail.com'

		},
		{
			xtype:'textfield',
			fieldLabel:'Address1',
			name:'address1',

			//	readOnly:true,
			value:'Margao'
		},
		{
			xtype:'textfield',
			fieldLabel:'Address2',
			name:'address2',

			//readOnly:true,
			value:'Davorlim'
		}
		//vtype:'email'

		],
		buttons:[{text:'Save',formBind:true,handler:function(){
			Ext.Msg.alert("Updated","Profile Updated Succesfully");
			win1.hide();
		}},{
		  text: 'Cancel',
		  handler:function(){
			win1.hide();
		}
			  
		}]

		/*   buttons:[{text: 'Edit' ,
        	handler:function()
        	{
        	var win1=new Ext.Window({
        	layout:'fit',
        	model:true,
        	height:310,
        	width:360,
        	title:'Edit Profile',
        	closable:false,
        	resizable:false,
        	plain:true,
        	border:false,
        	items:[simple],
        	buttons:[{text:'Save',handler:function(){
        		Ext.Msg.alert("Update","Succesful");
        	}}]
        	});
        	win1.show();
        	}

        		      },


            {text: 'Cancel'
       }
        ]*/
	});
	//change password form
	var changePassword = new Ext.FormPanel({
		labelWidth: 75, // label settings here cascade unless overridden
		url:'save-form.php',
		frame:true,
		//title: 'Register',
		bodyStyle:'padding:5px 5px 0',
		width: 350,
		defaults: {width: 230},
		//defaultType: 'textfield',

		items: [{
			xtype:'textfield',
			fieldLabel: 'Old Password',
			name: 'oldPassword',
			inputType:'password',
			allowBlank:false
			//vtype:'email'
		},

		{
			xtype:'textfield',
			fieldLabel: 'New Password',
			name: 'newPassword',
			inputType:'password',
			allowBlank:false
			//vtype:'email'
		}, {
			xtype:'textfield',
			fieldLabel: 'Confirm Password',
			name: 'cpassword',
			inputType:'password',
			allowBlank:false,
			validator: function(value) {
			var password = this.previousSibling('[name=newPassword]');
			return (value === password.getValue()) ? true : 'Passwords do not match.'
		}
		//vtype:'email'
		}
		],
		buttons:[{text:'Save', formBind:true,handler:function(){
			Ext.Msg.alert("Updated","Password Updated Succesfully");
			win1.hide();
		}},{
		  text: 'Cancel',
		  handler:function(){
			win1.hide();
		}
			  
		}]

	});
	var win1;
	var simple1 = new Ext.FormPanel({
		//labelWidth: 75, // label settings here cascade unless overridden
		//url:'save-form.php',
		frame:true,
		title: 'View Profile',
		bodyStyle:'padding:5px 5px 0; text-align: center',
		height:300,
		buttonAlign:'center',
		//renderTo:Ext.getBody(),
		//render:Ext.getBody(),
		//defaultType: 'textfield',

		items: [{
			xtype:'displayfield',
			fieldLabel: 'First Name',
			name: 'fname',
			value:'Samrat'
			


				//   readOnly:true

		},{
			xtype:'displayfield',
			fieldLabel: 'Last Name',
			name: 'last',

			//readOnly:true,
			value:'PrabhuDessai'
		},{
			xtype:'displayfield',
			fieldLabel: 'PhoneNo',
			name: 'phoneno',

			vtype:'num',
			//  readOnly:true,
			value:'2752485'
		}, {
			xtype:'displayfield',
			fieldLabel: 'Email',
			name: 'email',

			vtype:'email',
			// readOnly:true,
			value:'samrat@gmail.com'

		},
		{
			xtype:'displayfield',
			fieldLabel:'Address1',
			name:'address1',

			//	readOnly:true,
			value:'margao'
		},
		{
			xtype:'displayfield',
			fieldLabel:'Address2',
			name:'address2',

			//readOnly:true,
			value:'Davorlim'
		}
		//vtype:'email'

		],
		
		buttons:[{text: 'Edit',
			handler:function()
			{
			    win1=new Ext.Window({
				layout:'fit',
				model:true,
				height:310,
				width:360,
				title:'Edit Profile',
				closable:false,
				resizable:false,
				plain:true,
				border:false,
				buttonAlign:'center',
				items:[simple]
				
			});
			win1.show();
			}

		},{
			text: 'Change Password',
			handler: function() {
			//alert("Hi");
			    win1 = new Ext.Window({
				layout:'fit',
				model: true ,
				width:350,
				height:200,
				title:'Change Password',
				closable: false,
				resizable: false,
				plain: true,
				border: false,
				items: [changePassword]
			});	
			win1.show();
		}
		}]
	});
	simple1.render(right);

});